package com.huadao.cart_ccs.greendao.entity;


import com.huadao.cart_ccs.data.bo.CO2BO;
import com.huadao.cart_ccs.data.bo.O2BO;
import com.huadao.cart_ccs.data.bo.TemperatureBO;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;

import java.util.Date;
import org.greenrobot.greendao.annotation.Generated;

@Entity
public class EnvironmentParams {
    @Id
    private Long id;
    //项目
    private long projectId;
    //实验阶段
    private long stageId;
    //时间
    private Date date;
    //类型
    private byte type;
    //数据
    private double data;

    public static final byte TYPE_CO2=CO2BO.Atmosphere_CO2;
    public static final byte TYPE_O2=O2BO.Atmosphere_O2;
    public static final byte TYPE_Temperature=TemperatureBO.ModularType_Temperature;

    @Generated(hash = 1043889535)
    public EnvironmentParams(Long id, long projectId, long stageId, Date date,
            byte type, double data) {
        this.id = id;
        this.projectId = projectId;
        this.stageId = stageId;
        this.date = date;
        this.type = type;
        this.data = data;
    }
    @Generated(hash = 645802913)
    public EnvironmentParams() {
    }
    public Long getId() {
        return this.id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public long getProjectId() {
        return this.projectId;
    }
    public void setProjectId(long projectId) {
        this.projectId = projectId;
    }
    public long getStageId() {
        return this.stageId;
    }
    public void setStageId(long stageId) {
        this.stageId = stageId;
    }
    public Date getDate() {
        return this.date;
    }
    public void setDate(Date date) {
        this.date = date;
    }
    public byte getType() {
        return this.type;
    }
    public void setType(byte type) {
        this.type = type;
    }
    public double getData() {
        return this.data;
    }
    public void setData(double data) {
        this.data = data;
    }


    public String getTypeStr(){
        if(type==TYPE_CO2){
            return "CO2";
        }else if(type==TYPE_O2){
            return "O2";
        }else if(type==TYPE_Temperature){
            return "温度";
        }else {
            return "";
        }
    }

    //获取单位
    public String getUnit(){
        if(type==TYPE_CO2||type==TYPE_O2){
            return "%";
        }else if(type==TYPE_Temperature){
            return "℃";
        }else {
            return "";
        }
    }

}
